; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc -mcpu=pwr10 -ppc-asm-full-reg-names --enable-unsafe-fp-math \
; RUN:   -verify-machineinstrs --enable-no-signed-zeros-fp-math \
; RUN:   --enable-no-nans-fp-math \
; RUN:   -mtriple=powerpc64le-unknown-unknown < %s | FileCheck %s
; RUN: llc -mcpu=pwr10 -ppc-asm-full-reg-names -verify-machineinstrs \
; RUN:   -mtriple=powerpc64le-unknown-unknown < %s | FileCheck %s
define dso_local fp128 @testqmax(fp128 %a, fp128 %b) local_unnamed_addr {
; CHECK-LABEL: testqmax:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    xsmaxcqp v2, v2, v3
; CHECK-NEXT:    blr
entry:
  %cmp = fcmp ogt fp128 %a, %b
  %cond = select i1 %cmp, fp128 %a, fp128 %b
  ret fp128 %cond
}

define dso_local fp128 @testqmin(fp128 %a, fp128 %b) local_unnamed_addr {
; CHECK-LABEL: testqmin:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    xsmincqp v2, v2, v3
; CHECK-NEXT:    blr
entry:
  %cmp = fcmp olt fp128 %a, %b
  %cond = select i1 %cmp, fp128 %a, fp128 %b
  ret fp128 %cond
}

define dso_local fp128 @testqmax_fast(fp128 %a, fp128 %b) local_unnamed_addr {
; CHECK-LABEL: testqmax_fast:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    xsmaxcqp v2, v2, v3
; CHECK-NEXT:    blr
entry:
  %cmp = fcmp nnan ninf ogt fp128 %a, %b
  %cond = select i1 %cmp, fp128 %a, fp128 %b
  ret fp128 %cond
}

define dso_local fp128 @testqmin_fast(fp128 %a, fp128 %b) local_unnamed_addr {
; CHECK-LABEL: testqmin_fast:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    xsmincqp v2, v2, v3
; CHECK-NEXT:    blr
entry:
  %cmp = fcmp nnan ninf olt fp128 %a, %b
  %cond = select i1 %cmp, fp128 %a, fp128 %b
  ret fp128 %cond
}

declare fp128 @llvm.maxnum.f128(fp128, fp128)
define dso_local fp128 @testq_intrinsic_maxnum(fp128 %a, fp128 %b) local_unnamed_addr {
; CHECK-LABEL: testq_intrinsic_maxnum:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    xsmaxcqp v2, v2, v3
; CHECK-NEXT:    blr
entry:
  %0 = tail call fast fp128 @llvm.maxnum.f128(fp128 %a, fp128 %b)
  ret fp128 %0
}

declare fp128 @llvm.minnum.f128(fp128, fp128)
define dso_local fp128 @testq_intrinsic_minnum(fp128 %a, fp128 %b) local_unnamed_addr {
; CHECK-LABEL: testq_intrinsic_minnum:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    xsmincqp v2, v2, v3
; CHECK-NEXT:    blr
entry:
  %0 = tail call fast fp128 @llvm.minnum.f128(fp128 %a, fp128 %b)
  ret fp128 %0
}
